fix(engine): Prefer js_error! over JsError::from_opaque#5116
fix(engine): Prefer js_error! over JsError::from_opaque#5116jedel1043 merged 1 commit intoboa-dev:mainfrom
js_error! over JsError::from_opaque#5116Conversation
Test262 conformance changes
Tested main commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5116 +/- ##
===========================================
+ Coverage 47.24% 59.72% +12.48%
===========================================
Files 476 589 +113
Lines 46892 63471 +16579
===========================================
+ Hits 22154 37909 +15755
- Misses 24738 25562 +824 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jedel1043
left a comment
There was a problem hiding this comment.
Looks good, just a couple of nits
| @@ -85,7 +85,7 @@ macro_rules! impl_into_js_function { | |||
| match s.try_borrow_mut() { | |||
| Ok(mut r) => r( $($id,)* rest.into() ).try_into_js_result(ctx), | |||
| Err(_) => { | |||
| Err(JsError::from_opaque(js_string!("recursive calls to this function not supported").into())) | |||
| Err($crate::js_error!(ReferenceError: "recursive calls to this function not supported")) | |||
There was a problem hiding this comment.
These should also be plain Errors, right?
In a few places, native code was throwing
`JsError::from_opaque(js_string!("some literal"))`. This is allowed, but
it is not exactly standard: most users will expect thrown values to be
of type `Error`.
So, where possible, let's convert code using that to instead use the
provided `js_error!` macro, which does generate proper `Error` objects.
This doesn't touch `AbortError`, because (1) that's a larger code
change, and (2) it might actually be relied on as a sentinel value.
e5bd33f to
494a286
Compare
|
Hi, sorry for the delay on this! I've addressed the nit & rebased past the merge conflict. |
Test262 conformance changes
Tested main commit: |
In a few places, native code was throwing
JsError::from_opaque(js_string!("some literal")). This is allowed, but it is not exactly standard: most users will expect thrown values to be of typeError.So, where possible, let's convert code using that to instead use the provided
js_error!macro, which does generate properErrorobjects.This doesn't touch
AbortError, because (1) that's a larger code change, and (2) it might actually be relied on as a sentinel value.